<div class="modal fade bs-modal-lg" id="modelContent">
	<div class="modal-dialog modal-lg">
        <div class="modal-content"></div>
    </div>
</div> 

<div class="portlet box green">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>订单 &gt; 售后管理 &gt; 售后服务列表</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
    </div>
    <div style="background-color: rgb(249, 247, 161);">
		<label >
	</label>
	</div>
    <div class="portlet-body">
    	<div class="tabbable-line ">
			<ul class="nav nav-tabs ">
			
				<!-- <li>
					<a class="ajaxify">全部</a>
				</li>
				 -->
				<!-- <li #if(!$!searchModel.orderState) class="active" #end>
					<a href="/afterMarketOrder/list?state=0" class="ajaxify">已处理</a>
				</li> -->
				<!-- <li #if(!$!searchModel.orderState) class="active" #end>
					<a href="/afterMarketOrder/list?state=1" class="ajaxify">未处理</a>
				</li> -->
				<li>
					<a href="/service/list?currentstate=1" class="ajaxify" >已处理</a>
					
				</li> 
				<li>
					<a href="/service/list?currentstate=0" class="ajaxify">未处理</a>
				</li> 
			</ul>
			<div class="tab-content">
				<div class="tab-pane active form">
				</div>
			</div>
		</div>
		<div class="portlet-body form">
		   	<form action="/service/list" class="form-horizontal" method="get" id="searchForm" onsubmit="return false">
				<div class="form-body">
					<div class="row">
						<div class="col-md-3">
							<label class="col-md-4 control-label">单号：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="id" value="$!searchModel.id">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">会员：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="userName" value="$!searchModel.username">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">维保人：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="realName" value="$!searchModel.username">
							</div>
						</div>
		    		</div>
		    		<div class="row">
		    		&nbsp;<br/>
		    		</div>
		    		<div class="row">
						<div class="col-md-3">
							<label class="col-md-4 control-label">所属企业：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="company" value="$!searchModel.company">
							</div>
						</div>
						<div class="col-md-4">
							<label class="col-md-3 control-label">申请时间：</label>
							<div class="col-md-4">
						    	<input type="text" class="form-control" readOnly id="startTime" name="startTime" value="$!startTime">
						    	<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</div>
							<div class="col-md-1">~</div>
							<div class="col-md-4">
						    	<input type="text" class="form-control"readOnly id="endTime" name="endTime" value="$!endTime">
						    	<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</div>
						</div>
						<div class="col-md-2">
							<div class="actions col-md-12">
								<a href="javascript:;" class="btn green btn-sm ajax-search"><i class="fa fa-search"></i>查询 </a>
								<a href="javascript:;" class="btn green btn-sm search-reset"><i class="fa fa-eraser"></i> 清除 </a>
							</div>
						</div>
						<br>
						<a href="javascript:;" class="btn green btn-sm ajax-search"><i class="fa fa-search"></i>导出 </a>
		    		</div>
				</div>
				
			</form>
		</div>
		
    	<div class="dataTables_wrapper no-footer">
			<div class="table-scrollable">
			    <table class="table table-striped table-bordered table-hover">
				  	<thead>
						<tr>
		   		 			<th>维保订单</th>
		   		 			<th>状态</th>
		   		 			<th>维保项目</th>
		   		 			<th>维保会员</th>
		   		 			<th>维保联系人</th>
		   		 			<th>维保电话</th>
		   		 			<th>预约时间</th>
		   		 			<th>提交时间</th>
		   		 			<th>所属企业</th>
		   		 			<th>完成时间</th>
							<th class="col-md-2">操作</th>
						</tr>
					</thead>
					<tbody>
					#foreach($item in $pageOrder.result)
		  				<tr>
						    <td>
						    	$!item.id
						    </td>
						    <td> 
						    #if($!item.state==0) 未处理 
							    #else
							               已处理
							     #end
						    </td>
						    <td>$!item.maintennanceItem</td>
						    <td>$!item.userId</td>
						    <td>$!item.realName</td>
						     <td>$!item.ipohe</td>
						    <td>$!item.startTime</td>
						    <td>$!item.submitTime</td>
						    <td>$!item.company</td>
						    <td>$!item.finishTime </td>
						    
						    <td>
						    
						   	<a  class="see" >编辑</a>
						   <input type="hidden" class="itemId" value="$!item.id">
						   	
						   	<!-- href="/afterMarketOrder/show?id=$!item.id" -->
						    </td>
			    			<td>
			    				#if($!item.orderState == 'WAIT_AUDIT')
						    	<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/pass?id=$!item.id" tohref="/afterMarketOrder/list"> 
									<i class="fa fa-check"></i>通过
								</a>
								<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/refuse?id=$!item.id" tohref="/afterMarketOrder/list"> 
									<i class="fa fa-remove"></i>拒绝
								</a>
								#end
								#if($!item.orderState == 'TREASURER_AUDIT')
									<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/financePass?id=$!item.id" tohref="/afterMarketOrder/list"> 
										<i class="fa fa-check"></i>通过
									</a>
								#end
								#if($!item.orderState == 'BEING_REFUND')
									<a class="btn green btn-outline btn-sm ajax-model-get" href="#modelContent" thref="/afterMarketOrder/reFund?id=$!item.id" data-toggle="modal"> 
										<i class="fa fa-check"></i>退款
									</a>
								#end
								#if($!item.orderState == 'RETURNING_GOODS')
									<a class="btn green btn-outline btn-sm ajax-operation" thref="/afterMarketOrder/reviceGoods?id=$!item.id" tohref="/afterMarketOrder/list"> 
										<i class="fa fa-check"></i>收货完成
									</a>
								#end
						    </td>		  			
		  				</tr>
					#end
					</tbody>
				</table>
				    
				    
				        <div class="listmask">
                        <div class="list">
                         
                            <h1>维保详情</h1>
                            <div class="tabLists">
                        
                            </div>
                            <p class="tipse">
                                <span>处理结果：</span>

                                <textarea id="sign_edit" name="comment" maxlength="350" class="form-control" >请输入您的故障及维修方案</textarea>
                            </p>
                            <p class="tab"><button class="tab1">处理完成</button><button class="tab2">取消</button></p>
                        </div>
                    </div>
				    
				    
			</div>
			#set($page=$pageOrder)
			#set($pageUrl="/service/list?orderState=$!searchModel.orderState&pageNo=")
			#parse("_page.htm")
		</div>
    </div>
</div>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
 <style>
/*   .joinin{
    position: relative;
}
.header_1 .list tr{
    border-bottom: 1px solid #818181;

}
.header_1 .list tr:nth-child(1){
    border-bottom-color: white;
}
.header_1{
    padding-left: 8px;
}
.header_1 .list td{
    text-align: center;
    width:120px;
    height: 40px;
}
.header_1 .list td:nth-child(4){
    width: 250px;
}
.header_1 .list td p button{
    padding: 4px;
}
.header_1 .list td p .see{
    border-radius: 2px;
    background-color: red;
    color:white;
}
 */
/*弹框*/
.listmask{
    display: none;
    width: 100%;
    height: 100%;
    position: fixed;
    top:0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    margin-bottom: 50px;
}
 .listmask .list{
    background-color: white;
    padding: 0 20px 30px 20px;
    width: 780px;
    margin:150px auto;
    height: auto;
    z-index: 999;
    border: 1px solid #5cd1db;
}
.listmask .list h1{
    text-align: center;
    height: 40px;
    margin: 0 -20px;
    line-height: 40px;
    padding-left: 20px;
    font-size: 20px;
    background-color: #32c5d2;
	color:white;
}
.listmask .list .tipse{
    margin-top: 20px;
}
.listmask .list .tipse span{
    vertical-align:top;
}
.listmask .list #sign_edit{
	display:inline-block;
    width: 600px;
    height: 100px;
}
.listmask .list .taImg img{
    width: 32.9%;
}
.listmask table{
    border: none;
}
.listmask table td{
	width: 110px;
	height: 40px;
}
.listmask table.listto td:nth-child(even){
    text-align: left;
}
.listmask table.listto td:nth-child(odd){
    text-align: right;
}
.listmask .list .tab{
    margin-top: 20px;
    text-align: center;
}
.listmask .list .tab button{
    width:120px ;
    border: 1px solid #5cd1db;
    height: 35px;
	margin-right: 20px;
}
.listmask .list .tab button.tab1{
	background-color:#32c5d2;
	color: white;
}
.listmask .list .tab button.tab2{
	background-color: white;
}
  

</style>
<script type="text/javascript">
/* $(function(){
	window.open("edit.htm");
}) */
ComponentsSelect2.initWithSearch()
MyTouchSpin.init()

$("input[name= id]").focus();
var itemId ='';
$(".see").on("click",function() {
    $(".listmask").css("display","block");
   itemId =$(this).siblings('.itemId').val();
    console.log(itemId);
    var result = '';
    $.ajax({
        url:'/tosee',
        type:'post',
        dataType:'json',
        data:{
            "id":itemId
        },
        success:function(data){
            console.log(data);
             result+=
            '<table class="listto"><tr><td>维保单号：</td><td>'+data.id+'</td>'+
            '<td>状态：</td>';

                     if(data.state==0){
                         result+='<td>未处理</td>';
                     }else if(data.state==1){
                         result+='<td>已处理</td>';
                     }
            result+=
            '<td>维保项目：</td><td>'+
			'<select name="" id="itemName"><option selected value="">'+data.maintennanceItem+'</option><option value="">更换组件</option>' +
				'<option value="">更换硒鼓</option>' +
					'<option value="">更换黑盒</option>'+
				'</select>'+
//            '<input value="'+data.maintennanceItem+'">' +
				'</td></tr>' +
             '<tr><td>维保会员：</td><td>'+data.userId+'</td><td>所属企业：</td><td>'+data.company+'</td><td>部门：</td>'+
            '<td>'+data.companyDepartment+'</td></tr><tr><td>维保联系人：</td>'+
            '<td>'+data.realName+'</td><td>联系电话：</td><td>'+data.ipohe+'</td><td>提交时间：</td>'+
            '<td>'+data.submitTime+'</td></tr>'+
            '<tr><td>使用年限：</td><td>'+data.useTime+'</td><td>使用耗材：</td>'+
            '<td>'+data.usegoods+'</td><td>耗材品牌：</td><td>'+data.useBrand+'</td></tr>'+
            '<tr><td>预约时间：</td><td>'+data.startTime+'</td><td>处理人：</td>'+
            '<td>'+data.handlePeople+'</td><td>完成时间：</td><td>'+data.finishTime+'</td></tr>'+
            '<tr><td>描述：</td><td colspan="5">'+data.maintennanceDesc+'</td></tr></table>'+
            '<div class="taImg"><img src="'+data.image1+'" alt="">'+
                '<img src="'+data.image2+'"/>'+
                '<img src="'+data.image3+'"/></div>';


            $(".listmask .tabLists").append(result);
        },
    });
  
});
$(".tab2").on('click',function(){
	$(".listmask .tabLists").empty();
	$(".listmask").hide();
	
});

var pageContentBody = $('.page-content .page-content-body');

 $(".tab1").on('click',function(){
//	var id=$('.itemId').val();
	var desc=$('#sign_edit').val();
	var itemName=$("#itemName option:selected").text();
	//alert("详情"+desc+"项目名称"+itemName+"id"+id);
	console.log(itemId);
	 console.log(desc);
	 console.log(itemName);
    $.ajax({
        url:'/handleafter',
        type:'post',
        dataType:'json',
        data:{
        	"itemName":itemName,
            "id":itemId,
            "desc":desc
        },
        success:function(data){
            console.log(data);
        	$(".listmask .tabLists").empty();
        	$(".listmask").css("display","none");
//        	window.onload=function(){
//
//        	};
        	//window.location.href="service/list";
        	/* if(data.code = 0){
    			$('#modelContent').modal("hide");
                $('.modal-backdrop').hide();
        		pageContentBody.load("/service/list");
                toastr.success(res.msg);
        	}else{
        		toastr.warning(res.msg);
        	}
            App.stopPageLoading();
            Layout.fixContentHeight(); */
            
        }
    });
 
});
</script>
